home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / fioben.zip / CAT4.CPP < prev    next >
C/C++ Source or Header  |  1993-02-09  |  1KB  |  64 lines

  1. #include    <windows.h>
  2. #include    <iostream.h>
  3. #include    <iomanip.h>
  4. #include    <fstream.h>
  5. #include    <string.h>
  6.  
  7. ofstream    CERR("results.out", ios::app);
  8. int    BUFLEN = 0x10000;
  9.  
  10. ostream    & operator << (ostream & os, SYSTEMTIME & r)
  11. {
  12.     static    const char    * const rgszDayNames[] =
  13.         {
  14.         "Sunday",
  15.         "Monday",
  16.         "Tuesday",
  17.         "Wednesday",
  18.         "Thursday",
  19.         "Friday",
  20.         "Saturday",
  21.         0
  22.         };
  23.     char    chFill = os.fill();
  24.     os.fill('0');
  25.     os //--------------------------------- << rgszDayNames[r.wDayOfWeek] << ' '
  26.         << setw(2) << r.wMonth << '/'
  27.         << setw(2) << r.wDay << '/'
  28.         << setw(2) << r.wYear << ' '
  29.         << setw(2) << r.wHour << ':'
  30.         << setw(2) << r.wMinute << ':'
  31.         //------------------- << setw(2) << r.wSecond
  32.         ;
  33.     os.fill(chFill);
  34.     return    os;
  35. }
  36.  
  37. int main(int argc, char **argv)
  38. {
  39.     SYSTEMTIME    sNow;
  40.     GetLocalTime(&sNow);
  41.     CERR << sNow << "===> " << GetCommandLine() << endl;
  42.     if (argc < 2)
  43.         {
  44.         cin.get(*cout.rdbuf(), EOF);
  45.         return    0;
  46.         }
  47.     DWORD    dwStart = GetTickCount();
  48.     for (int iArg = 1; iArg < argc; iArg++)
  49.         {
  50.         ifstream    ifs(argv[iArg], ios::in | ios::binary);
  51.         if (!ifs)
  52.             {
  53.             CERR << "Error opening input file: " << argv[iArg] << endl;
  54.             continue;
  55.             }
  56.         ifs.get(*cout.rdbuf(), EOF);
  57.         }
  58.     dwStart = GetTickCount( ) - dwStart;
  59.      CERR << "**** Total time: " << (dwStart / 1000)
  60.         << '.' << (dwStart % 1000) << " seconds."
  61.         << endl;
  62.     return    0;
  63. }
  64.